Re: [NTG-context] issue in Lua syntax formatting

2022-05-31 Thread Max Chernoff via ntg-context
the formatting of Lua multi-line strings messes up the source structure, in the following MWE, the "one" is displayed after "[[": \starttext \startLUA words = [[ one two three ]] \stopLUA \stoptext I can reproduce this. As a workaround, you can insert a non-bre

[NTG-context] issue in Lua syntax formatting

2022-05-30 Thread Henning Hraban Ramm via ntg-context
Hi, the formatting of Lua multi-line strings messes up the source structure, in the following MWE, the "one" is displayed after "[[": \starttext \startLUA words = [[ one two three ]] \stopLUA \stoptext (Denis recognized that in his MAPS/CGJ article on ligatur

Re: [NTG-context] MKIV - LMTX difference: stripping of leading white space in verbatim text

2020-09-03 Thread Christoph Reller
On Thu, Sep 3, 2020 at 5:53 AM Wolfgang Schuster < wolfgang.schuster.li...@gmail.com> wrote: > Christoph Reller schrieb am 03.09.2020 um 05:29: > > Dear List, > > > > I am using ConTeXt LMTX 2018.05.19 21:46. Consider the following MWE: > > > > \st

Re: [NTG-context] MKIV - LMTX difference: stripping of leading white space in verbatim text

2020-09-02 Thread Wolfgang Schuster
Christoph Reller schrieb am 03.09.2020 um 05:29: Dear List, I am using ConTeXt LMTX 2018.05.19 21:46. Consider the following MWE: \starttext \startLUA     whatever \stopLUA \stoptext In contrast to ConTeXt MKIV, the leading four spaces in front of "whatever" are not removed when

[NTG-context] MKIV - LMTX difference: stripping of leading white space in verbatim text

2020-09-02 Thread Christoph Reller
Dear List, I am using ConTeXt LMTX 2018.05.19 21:46. Consider the following MWE: \starttext \startLUA whatever \stopLUA \stoptext In contrast to ConTeXt MKIV, the leading four spaces in front of "whatever" are not removed when processing the verbatim text: MKIV output: what

Re: [NTG-context] conditional for undefined references

2020-03-29 Thread Wolfgang Schuster
]}]])} Is it defined?: \startlua if [[{\in[seac]}]] == "??" then context("undefined") else context("defined") end \stoplua \stoptext Is there a way to deal with undefined references? I mean, I need a conditional to handle u

[NTG-context] conditional for undefined references

2020-03-29 Thread Pablo Rodriguez
Dear list, consider the following sample: \setuppapersize[A8] \starttext \ConTeXt: \in[seac] Is it defined?: \doifelse{\in[seac]}{??}{undefined}{defined} \Lua: \ctxlua{context([[{\in[seac]}]])} Is it defined?: \startlua if [[{\in[seac

Re: [NTG-context] passing variables/data between context and lua

2019-10-05 Thread Rudolf Bahr
> A solution which uses only existing commands in the document. > > \startsetups [martin] > \startlua > local points = tonumber(\getvariable{martin}{question}) or 0 ; > points = points * 92 ; > local answer = 42 ; > context.setv

Re: [NTG-context] passing variables/data between context and lua

2019-09-29 Thread Martin Althoff
isting commands in the document. > > \startsetups [martin] > \startlua > local points = tonumber(\getvariable{martin}{question}) or 0 ; >points = points * 92 ; > local answer = 42 ; > context.setvariable("martin","points

Re: [NTG-context] passing variables/data between context and lua

2019-09-27 Thread Wolfgang Schuster
A solution which uses only existing commands in the document. \startsetups [martin]     \startlua     local points = tonumber(\getvariable{martin}{question}) or 0 ;   points = points * 92 ;     local answer = 42 ;     context.setvariable("martin","

Re: [NTG-context] Fwd: [garden] debug getinfo error

2019-07-10 Thread Hans Hagen
  > lua error on line 6 in file /tmp/uhd8RE/texweb.tex: [ctxlua]:1: attempt to call a nil value (field 'getinfo') 1 % generated by live script 2 \setupexternalfigures[location={local,global,default}] 3 \starttext 4 \start

[NTG-context] Fwd: [garden] debug getinfo error

2019-07-10 Thread Taco Hoekwater
fonts (second stage) > fonts > 'fallback modern-designsize rm 12pt' is loaded > > lua error > lua error on line 6 in file /tmp/uhd8RE/texweb.tex: > > [ctxlua]:1: attempt to call a nil value (field 'getinfo') > > 1 % genera

Re: [NTG-context] Use of context in lua

2018-08-15 Thread Henri Menke
On 15/08/18 17:46, Jan U. Hasecke wrote: On 14.08.2018 16:58, Pablo Rodriguez wrote: I rewrote your sample as (xtables are the only tables I know in ConTeXt): \starttext \startlua context.startxtable() context.startxrow() context.startxcell

[NTG-context] Use of context in lua (was: date calculated with currentdate plus n days)

2018-08-14 Thread Jan U. Hasecke
On 14.08.2018 16:58, Pablo Rodriguez wrote: > I rewrote your sample as (xtables are the only tables I know in ConTeXt): > > \starttext > \startlua > context.startxtable() > context.startxrow() > context.startxcell() >

Re: [NTG-context] date calculated with currentdate plus n days

2018-08-14 Thread Pablo Rodriguez
s are the only tables I know in ConTeXt): \starttext \startlua context.startxtable() context.startxrow() context.startxcell() context("Note 1") context.stopxcell() context.startxcell() context("Note 2&q

Re: [NTG-context] integer displayed as .0 float in Lua-5.3

2018-08-11 Thread Pablo Rodriguez
I must confess that this is a new knowledge to me. I thought that "[[ ]]" was the form to escape what I think it is the escape character in Lua. How I came to that assumption? Probably because I tried to add a raw command to \ctxlua or inside a \startlua...\stoplua. > You can jus

[NTG-context] SHA512 for LuaTeX-5.2

2018-07-22 Thread Pablo Rodriguez
Dear list, I have the following sample (adapted from https://stackoverflow.com/q/50442185): ✂️ \starttext \startlua -- -- UTILITY FUNCTIONS -- -- transform a string of bytes in a string of hexadecimal digits local function str2hexa (s

Re: [NTG-context] issue with string.collapsespaces()

2018-02-12 Thread Hans Hagen
On 2/12/2018 5:00 PM, Pablo Rodriguez wrote: Dear list, I have the following sample: \starttext \startlua a = "a bc de" context(string.collapsespaces(a)) \stoplua \stoptext Sorry for the stupid question, but isn’t the collapsespaces function intended

[NTG-context] issue with string.collapsespaces()

2018-02-12 Thread Pablo Rodriguez
Dear list, I have the following sample: \starttext \startlua a = "a bc de" context(string.collapsespaces(a)) \stoplua \stoptext Sorry for the stupid question, but isn’t the collapsespaces function intended to remove spaces? What am I missing here? Many thank

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-26 Thread SteamedFish
comment: \inlineTEX{ag%befe} \Lua\ inline comment: \inlineLUA{agb --efe} \startTEX This is text. % a comment, not \comment \stopTEX \startXML This is text. \stopXML \startLUA if code=="code" then --this is a comment \stopLUA \stopTEXpage \stoptext > On 22 Dec 2017, at 4

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Pablo Rodriguez
\starttext \startTEXpage[offset=2em] \startLUA --[[ multiline comment ]]-- ---[[ multiline comment ]]--- \stopLUA \stopTEXpage \stoptext Many thanks for your help again,

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-21 Thread Christoph Reller
\context{ag%befe} > > \Lua\ inline comment: \lua{agb --efe} > > \startTEX > This is text. % a comment, not \comment > \stopTEX > > \startXML > This is text. > \stopXML > > \startLUA > if code=="code" then

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-20 Thread Hans Hagen
} \Lua\ inline comment: \lua{agb --efe} \startTEX This is text. % a comment, not \comment \stopTEX \startXML This is text. \stopXML \startLUA if code=="code" then --this is a comment \stopLUA \stopTEXpage \stoptext Would it b

Re: [NTG-context] type and typing comments for TeX and Lua

2017-12-19 Thread Aditya Mahajan
, not \comment \stopTEX \startXML This is text. \stopXML \startLUA if code=="code" then --this is a comment \stopLUA \stopTEXpage \stoptext Would it be possible that all comments in type and typing (at least, for Lua, XML and TeX) would have the same formatting for

[NTG-context] type and typing comments for TeX and Lua

2017-12-18 Thread Pablo Rodriguez
} \startTEX This is text. % a comment, not \comment \stopTEX \startXML This is text. \stopXML \startLUA if code=="code" then --this is a comment \stopLUA \stopTEXpage \stoptext Would it be possible that all comments in type and typing (at least, fo

[NTG-context] three issues with \setuptyping

2017-10-21 Thread Pablo Rodriguez
This is text. \stopXML \startLUA if code=="code" then --this is a comment --[[ this is a multiline comment --]] not part of the comment ---[[ this isn’t a multiline comment ---]] \stopLUA \stopTEXpage \stoptext I’m experien

[NTG-context] (again) issues with typing

2017-08-16 Thread Pablo Rodriguez
[offset=1em] \startTEX This is text. % and this is a comment \stopTEX \startXML This is text. \stopXML \startLUA if code=="code" then --this is a comment --[[ this is a multiline comment --]] ---[[ this isn’t a multili

[NTG-context] comment colors in \typebuffers

2017-08-08 Thread Pablo Rodriguez
Hans, I have the following sample: \starttext \startTEXpage[offset=1em] \startTEX This is text. % and this is a comment \stopTEX \startXML This is text. \stopXML \startLUA if code=="code" then --this is a comment --[[ and this is a

Re: [NTG-context] Modes in Lua

2017-06-01 Thread Henning Hraban Ramm
know how to do it >> for \mainlanguage (**en). >> \mainlanguage[es] >> \starttext >> \en\startlua >> if tex.systemmodes['en'] then >> context('Language is English.') >> else >> context('Language is not Englis

Re: [NTG-context] Modes in Lua

2017-05-31 Thread Hans Hagen
)? This is the way to detect system modes, but I don’t know how to do it for \mainlanguage (**en). \mainlanguage[es] \starttext \en\startlua if tex.systemmodes['en'] then context('Language is English.') else context('Language is not English.') end context

Re: [NTG-context] Modes in Lua

2017-05-31 Thread Pablo Rodriguez
On 05/31/2017 04:51 PM, Pablo Rodriguez wrote: > [...] > This is the way to detect system modes, but I don’t know how to do it > for \mainlanguage (**en). It was simple (not even using tex.systemmodes): \mainlanguage[es] \starttext \en\startlua if tex.m

Re: [NTG-context] Modes in Lua

2017-05-31 Thread Pablo Rodriguez
odes (*en)? This is the way to detect system modes, but I don’t know how to do it for \mainlanguage (**en). \mainlanguage[es] \starttext \en\startlua if tex.systemmodes['en'] then context('Language is English.') else context('Language is not English.')

Re: [NTG-context] How to define a TeX logic function with a boolean returned from a Lua function and \edef fixed value

2017-01-18 Thread Hans Hagen
On 1/18/2017 4:29 PM, DesdeChaves wrote: Dear sirs, Is there a way to compare, in TeX environment, a value returned from a lua function with a TeX variable? Please see this code: \def\aleatorioValue{ \startlua local nu = math.random(1,10); if nu<5 return 1 else return 0 end \stop

[NTG-context] How to define a TeX logic function with a boolean returned from a Lua function and \edef fixed value

2017-01-18 Thread DesdeChaves
Dear sirs, Is there a way to compare, in TeX environment, a value returned from a lua function with a TeX variable? Please see this code: \def\aleatorioValue{ \startlua local nu = math.random(1,10); if nu<5 return 1 else return 0 end \stoplua } \edef\controlValue{1} \edef\inferior{Number

Re: [NTG-context] scancsv module and lua

2017-01-16 Thread DesdeChaves
gt; --- example -- > > \usemodule[scancsv] > > \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator > \startlua > local parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); > local day=tonumber(parsedate[1]); > local month=tonumber(parsedate

[NTG-context] scancsv module and lua

2017-01-16 Thread DesdeChaves
d data to the output. The result is a empty pdf. The example attached is from a old question. Thanks a lot for your time Jorge M. --- example -- \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua local parsedate=thirddata.scancsv.P

Re: [NTG-context] A macro which gives a random name

2015-04-19 Thread Otared Kavian
', 'G', 'u', 'v', 'W'} \stopluacode \define\RandomFunctionName {\startlua local listsize= \letterhash Name ; local randomvalue = math.random(1,listsize) ; context(Name[randomvalue]) \stoplua} \dorecurse{10}{Give an example of a function $\RandomFunctionName : {\Bbb R

Re: [NTG-context] A macro which gives a random name

2015-04-19 Thread Hans Hagen
', 'W'} \stopluacode \define\RandomFunctionName {\startlua local listsize= \letterhash Name ; local randomvalue = math.random(1,listsize) ; context(Name[randomvalue]) \stoplua} \dorecurse{10}{Give an example of a function $\RandomFunctionName : {\Bbb R} \longrightarrow {\Bbb R

Re: [NTG-context] A macro which gives a random name

2015-04-18 Thread Wolfgang Schuster
Name = {'F', 'G', 'u', 'v', 'W'} \stopluacode \define\RandomFunctionName {\startlua local listsize= \letterhash Name ; local randomvalue = math.random(1,listsize) ; context(Name[randomvalue]) \stoplua} \dorecurse{10}{Give an example of a function $\RandomFunctionName : {\Bbb R

Re: [NTG-context] A macro which gives a random name

2015-04-18 Thread Otared Kavian
when you use it in a TeX command because # is already taken for the TeX arguments. \starttext \startluacode Name = {'F', 'G', 'u', 'v', 'W'} \stopluacode \define\RandomFunctionName {\startlua local listsize= \letterhash Name ; local randomvalue = math.random(1,listsize

Re: [NTG-context] A macro which gives a random name

2015-04-18 Thread Hans Hagen
to replace # with \letterhash when you use it in a TeX command because # is already taken for the TeX arguments. \starttext \startluacode Name = {'F', 'G', 'u', 'v', 'W'} \stopluacode \define\RandomFunctionName {\startlua local listsize= \letterhash Name ; local randomvalue

Re: [NTG-context] A macro which gives a random name

2015-04-18 Thread Otared Kavian
# with \letterhash when you use it in a TeX command because # is already taken for the TeX arguments. \starttext \startluacode Name = {'F', 'G', 'u', 'v', 'W'} \stopluacode \define\RandomFunctionName {\startlua local listsize= \letterhash Name ; local randomvalue

Re: [NTG-context] expand date from CSV file

2014-12-18 Thread Jaroslav Hajtmar
Hi Pablo Here is a quick solution. However, it not treat the incorrect input data, ie it requires, however, correct input, otherwise it will collapse ... Jaroslav Hajtmar \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua parsedate

Re: [NTG-context] expand date from CSV file

2014-12-18 Thread Jaroslav Hajtmar
used. Sincerely Jaroslav Hajtmar \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua local parsedate=thirddata.scancsv.ParseCSVLine('#1','#2'); local day=tonumber(parsedate[1]); local month=tonumber(parsedate[2]); local year

Re: [NTG-context] expand date from CSV file

2014-12-18 Thread Pablo Rodriguez
defined in the library, so that it can be successfully used. Many thanks for your reply, Jaroslav. This is exactly what I need. Many thanks for your help, Pablo \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua local parsedate

Re: [NTG-context] expand date from CSV file

2014-12-18 Thread Jaroslav Hajtmar
), while 01/02/15 mean old man ie. in fact 01/02/1915. For the specific case you have to modify or create the solution separately. Greetings Jaroslav Hajtmar Here is new minimal example: \usemodule[scancsv] \def\ddmm#1#2#3{% #1 - date, #2 - old separator, #3 - new separator \startlua local

Re: [NTG-context] Ctx: list of commands

2012-09-18 Thread Procházka Lukáš Ing . - Pontex s . r . o .
}, [startJSpreamble]={ 127, 290644, 49920 }, [startLUA]={ 127, 245948, 28541 }, [startLuaSnippet]={ 127, 244345, 530 }, [startLuaSnippetBoundary]={ 127, 246417, 46341 }, [startLuaSnippetComment]={ 127, 247113, 23071 }, [startLuaSnippetName]={ 127, 246301, 9781 }, [startLuaSnippetNameBase]={ 127, 244439

Re: [NTG-context] expansion and \processaction

2012-06-07 Thread Wolfgang Schuster
comma command. You can also try to use a Lua variant. \def\states_entry_indeed[#1][#2]% {\startlua local entries = utilities.parsers.settings_to_array(#1) local entry = entries[#2] if entry then context(entry) else context(\\tttf NO ENTRY!) end \stoplua} Wolfgang

Re: [NTG-context] expansion and \processaction

2012-06-07 Thread Hans Hagen
On 7-6-2012 18:02, Wolfgang Schuster wrote: You can also try to use a Lua variant. \def\states_entry_indeed[#1][#2]% {\startlua local entries = utilities.parsers.settings_to_array(#1) local entry = entries[#2] if entry then context(entry) else context(\\tttf NO ENTRY

Re: [NTG-context] expansion and \processaction

2012-06-07 Thread Wolfgang Schuster
Am 07.06.2012 um 18:16 schrieb Hans Hagen: On 7-6-2012 18:02, Wolfgang Schuster wrote: You can also try to use a Lua variant. \def\states_entry_indeed[#1][#2]% {\startlua local entries = utilities.parsers.settings_to_array(#1) local entry = entries[#2] if entry

Re: [NTG-context] CLD: context.getvariable as Lua variable

2012-01-05 Thread Wolfgang Schuster
) else context(NOT EMPTY) end end \stopluacode \setvariable{wagner}{name}{Wagner Macedo} \starttext \ctxlua{userdata.checkvariable(\getvariable{wagner}{name})} % This does only with \startlua or \ctxlua \startlua local name = \getvariable{wagner}{name} if name

Re: [NTG-context] CLD: context.getvariable as Lua variable

2012-01-05 Thread Wagner Macedo
} \starttext \ctxlua{userdata.checkvariable(\getvariable{wagner}{name})} % This does only with \startlua or \ctxlua \startlua local name = \getvariable{wagner}{name} if name == then context(No Text) else name = Name: .. name context(name) end \stoplua \stoptext A different method

Re: [NTG-context] \inpu

2012-01-01 Thread Wolfgang Schuster
Am 01.01.2012 um 08:00 schrieb luigi scarso: On Sun, Jan 1, 2012 at 4:28 AM, Michael Talbot-Wilson m...@view.net.au wrote: I thought I'd see if I could use ConTeXt. Here is my first try, hello.tex. \starttext \input header Hello, World!\startlua a = 1.5 b = 1.8 c = a * b tex.print

[NTG-context] \inpu

2011-12-31 Thread Michael Talbot-Wilson
I thought I'd see if I could use ConTeXt. Here is my first try, hello.tex. \starttext \input header Hello, World!\startlua a = 1.5 b = 1.8 c = a * b tex.print(c) \stoplua plus1. \stoptext Didn't work because the file header.tex could not be found, even though kpsewhich can find

Re: [NTG-context] \inpu

2011-12-31 Thread luigi scarso
On Sun, Jan 1, 2012 at 4:28 AM, Michael Talbot-Wilson m...@view.net.au wrote: I thought I'd see if I could use ConTeXt.  Here is my first try, hello.tex. \starttext \input header Hello, World!\startlua a = 1.5 b = 1.8 c = a * b tex.print(c) \stoplua plus1. \stoptext Didn't work

Re: [NTG-context] mkiv: verbatim lua eats my quotes

2011-01-10 Thread Hans Hagen
On 9-1-2011 10:16, Thomas A. Schmitz wrote: \starttext \startLUA require 'lpeg' sep = lpeg.P(,) \stopLUA \stoptext I'll put a beta on the ftp for testing. You can configure the string content as well as the quotes

Re: [NTG-context] mkiv: verbatim lua eats my quotes

2011-01-10 Thread Thomas A. Schmitz
On Jan 10, 2011, at 2:14 PM, Hans Hagen wrote: On 9-1-2011 10:16, Thomas A. Schmitz wrote: \starttext \startLUA require 'lpeg' sep = lpeg.P(,) \stopLUA \stoptext I'll put a beta on the ftp for testing. You can configure the string content as well as the quotes. Hi Hans

[NTG-context] mkiv: verbatim lua eats my quotes

2011-01-09 Thread Thomas A. Schmitz
Hi all, is this a bug or a feature: in verbatim lua code, my double and ' single quotation marks are eaten up in mkiv (everything is colorless, but correct in mkii). Example: \starttext \startLUA require 'lpeg' sep = lpeg.P(,) \stopLUA \stoptext Thanks Thomas

Re: [NTG-context] problem with \setuptyping[option=LUA, escape=//]

2010-08-26 Thread Peter Münster
{typefile-test} % problem here \stop \section{file=zzz, lua=xxx-yyy} \start \setuptyping[file][option=LUA, escape=ZZZ] \setuptyping[LUA][option=LUA, escape={XXX,YYY}] \startLUA btex-etex: // /btex \em sometex /etex xxx-yyy:// XXX \em sometex YYY zzz:// ZZZ \em sometex \stopLUA \typefile

Re: [NTG-context] [***SPAM***] problem with \setuptyping[option=LUA, escape=//]

2010-08-25 Thread Hans Hagen
}] \starttext \startLUA bla // /btex\em sometex /etex \stopLUA \stoptext Hopefully you wikify this Hans - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt

[NTG-context] funny bug

2010-05-10 Thread Peter Münster
Hello, \starttext \startLUA printbla -- words are transposed! \stopLUA \stoptext Cheers, Peter -- Contact information: http://pmrb.free.fr/contact/ ___ If your question is of interest

Re: [NTG-context] funny bug

2010-05-10 Thread Hans Hagen
On 10-5-2010 10:43, Peter Münster wrote: \starttext \startLUA printbla-- words are transposed! \stopLUA \stoptext in pret-lua.lua, line 265: elseif c == '' or c == ' then if word then state = flush_lua_word(state,word) word = nil end

Re: [NTG-context] tab disappears in LUA environment.

2010-04-07 Thread Hans Hagen
On 7-4-2010 5:13, Hongwen Qiu wrote: \startLUA string.format(%s %d, person, total) \stopLUA space handling fixed in next beta - Hans Hagen | PRAGMA ADE Ridderstraat 27

[NTG-context] tab disappears in LUA environment.

2010-04-06 Thread Hongwen Qiu
\startLUA string.format(%s %d, person, total) \stopLUA produces the result as following: string.format(%s%d, person, total) while the following code has no such problem: \starttyping string.format(%s %d, person, total) \stoptyping $ context --version MTXrun | current version: 2010.03.30 18:56

Re: [NTG-context] Why are pretty printer names uppercased?

2009-08-26 Thread Hans Hagen
Matthijs Kooijman wrote: Hi all, according to the wiki, and the current code, the arguments to \installprettytype should be uppercased. E.g.: because want uppercase \startTEX \stopTEX \startMP \stopMP \startLUA \stopLUA \installprettytype [PHP][PHP] Referring to them should

Re: [NTG-context] t-vim: inline typing?

2009-07-20 Thread Aditya Mahajan
,colorscheme=blackandwhite] \startLUA -- version : 1.0.0 - 07/2005 -- author: Hans Hagen - PRAGMA ADE - www.pragma-ade.com -- copyright : public domain or whatever suits -- remark: part of the context distribution -- TODO: name space for local functions -- loading: scite-ctx.properties

[NTG-context] Problem Passing \starttabulate into Lua

2008-12-27 Thread Tad Ashlock
... \testmacro ...\directlua 0{d='\luaescapestring {#1 }'} l.8 \stoptabulate} ? = I've tried all sorts of variations on the above example including using \ctxlua, \startlua, \startluacode, etc. I tried using

[NTG-context] passing buffer to lua functions

2008-09-29 Thread Olivier
Dear all, I'm trying to implement a very simple filter mechanism in lua like this: \def\test#1{% \startlua local pipe, str pipe = io.popen(./my_filter '\luaescapestring{#1}', r) str = pipe:read(*a) tex.print(str) pipe:close() \stoplua } \test{% line 1 line 2

Re: [NTG-context] missing btex ..etex in mp figure

2008-05-17 Thread Hans Hagen
Taco Hoekwater wrote: luigi scarso wrote: In \starttext \startTEXpage \startlua metapost.process(metafun,{beginfig(1);, a=.7in; b=0.5in;, z0=(0,0); z1=(a,0); z2=(0,b);, z0=.5[z1,z3]=.5[z2,z4];, draw z1..z2..z3..z4..cycle;, drawarrow z0..z1;, drawarrow z0..z2;, label.top(btex

Re: [NTG-context] missing btex ..etex in mp figure

2008-05-16 Thread Taco Hoekwater
luigi scarso wrote: In \starttext \startTEXpage \startlua metapost.process(metafun,{beginfig(1);, a=.7in; b=0.5in;, z0=(0,0); z1=(a,0); z2=(0,b);, z0=.5[z1,z3]=.5[z2,z4];, draw z1..z2..z3..z4..cycle;, drawarrow z0..z1;, drawarrow z0..z2;, label.top(btex $a$ etex, .5[z0,z1

[NTG-context] missing btex ..etex in mp figure

2008-05-15 Thread luigi scarso
In \starttext \startTEXpage \startlua metapost.process(metafun,{beginfig(1);, a=.7in; b=0.5in;, z0=(0,0); z1=(a,0); z2=(0,b);, z0=.5[z1,z3]=.5[z2,z4];, draw z1..z2..z3..z4..cycle;, drawarrow z0..z1;, drawarrow z0..z2;, label.top(btex $a$ etex, .5[z0,z1]);, label.lft(btex $b$ etex, .5[z0,z2

Re: [NTG-context] mplib

2008-04-23 Thread Wolfgang Werners-Lucchini
Hallo Taco et al \startlua local function finder(name, mode, ftype) if mode==w then return name else return kpse.find_file(name,ftype) end end Jein! Try this, a little more elaborate, version of finder: local function finder(name

Re: [NTG-context] mplib

2008-04-19 Thread Wolfgang Werners-Lucchini
\startlua local function finder(name, mode, ftype) if mode==w then return name else return kpse.find_file(name,ftype) end end Jein! The only file in my tex tree which could play that roule is cont-en-mpost.mem in the cache \tex\texmf-cache

Re: [NTG-context] mplib

2008-04-19 Thread Hans Hagen
Wolfgang Werners-Lucchini wrote: \startlua local function finder(name, mode, ftype) if mode==w then return name else return kpse.find_file(name,ftype) end end Jein! The only file in my tex tree which could play that roule is cont-en-mpost.mem

Re: [NTG-context] mplib

2008-04-19 Thread Taco Hoekwater
Wolfgang Werners-Lucchini wrote: \startlua local function finder(name, mode, ftype) if mode==w then return name else return kpse.find_file(name,ftype) end end Jein! Try this, a little more elaborate, version of finder: local function finder(name

Re: [NTG-context] mplib

2008-04-18 Thread Wolfgang Werners-Lucchini
? --- \starttext % start low-level \startlua local function finder(name, mode, ftype) if mode==w then return name else return kpse.find_file(name,ftype) end end mp = mplib.new ( { hash_size = 10, main_memory = 200, param_size

Re: [NTG-context] mplib

2008-04-16 Thread Wolfgang Werners-Lucchini
that one has not to adapt 'plain.mp'. But here too, there is no 'mpost.mem' and no 'mpost.log'. I have included a test before and after mp:finish(). Can anybody with a minimal under windows run this example? --- \starttext % start low-level \startlua local function

Re: [NTG-context] Unable to generate luatex formats

2008-04-15 Thread John Devereux
) \starttext \ctxlua{a = 1.5 ; b = 1.8 ; c = a*b ; tex.print(c) ;} or the equivalent: \startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua You can also do more elaborate calculations with the lua math library

Re: [NTG-context] Unable to generate luatex formats

2008-04-15 Thread Hans van der Meer
On 15 apr 2008, at 14:52, John Devereux wrote: 4) Now you can try some simple document like (thanks to Arthur Reutenauer) \starttext some statements deleted \startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua \stoptext

Re: [NTG-context] Unable to generate luatex formats

2008-04-15 Thread Hans Hagen
Hans van der Meer wrote: On 15 apr 2008, at 14:52, John Devereux wrote: 4) Now you can try some simple document like (thanks to Arthur Reutenauer) \starttext . some statements deleted \startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua

Re: [NTG-context] mplib

2008-04-15 Thread Wolfgang Werners-Lucchini
be. It is not in 'D:\context\tex\texmf-mswin\web2c' where format-files usally exist. It is not in the cache. I run this: --- \enableregime[utf-8] \starttext % start low-level \startlua local function finder(name, mode, ftype) if mode==w

Re: [NTG-context] mplib

2008-04-14 Thread Wolfgang Werners-Lucchini
On 13 Apr 2008 at 13:31, [EMAIL PROTECTED] wrote: Hallo Taco, thank you for your example. % start low-level \startlua local function finder(name, mode, ftype) if mode==w then return name else return kpse.find_file(name,ftype) end end mp = mplib.new

Re: [NTG-context] mplib

2008-04-13 Thread Taco Hoekwater
Wolfgang Werners-Lucchini wrote: On 12 Apr 2008 at 9:39, [EMAIL PROTECTED] wrote: \startlua mp = mplib.new ( { hash_size = 10, main_memory = 200, param_size = 10, } ) if mp then res = mp:execute( beginfig(1) draw (0,0) .. (1,1) .. (2,1); endfig; bye

Re: [NTG-context] mplib

2008-04-12 Thread Hans Hagen
Wolfgang Werners-Lucchini wrote: Hallo, the following compiles ok, but gives me an status 3=fatal error. Can someone please point me to the error? \startlua mp = mplib.new ( { hash_size = 10, main_memory = 200, param_size = 10, } ) if mp then res

Re: [NTG-context] mplib

2008-04-12 Thread Wolfgang Werners-Lucchini
On 12 Apr 2008 at 9:39, [EMAIL PROTECTED] wrote: \startlua mp = mplib.new ( { hash_size = 10, main_memory = 200, param_size = 10, } ) if mp then res = mp:execute( beginfig(1) draw (0,0) .. (1,1) .. (2,1); endfig; bye; ) tex.print

[NTG-context] mplib

2008-04-11 Thread Wolfgang Werners-Lucchini
Hallo, the following compiles ok, but gives me an status 3=fatal error. Can someone please point me to the error? \startlua mp = mplib.new ( { hash_size = 10, main_memory = 200, param_size = 10, } ) if mp then res = mp:execute( beginfig(1) draw (0,0) .. (1,1) .. (2,1

[NTG-context] Bibliography and luatex

2008-01-16 Thread Jean Magnan de Bornier
[] \setuppublicationlist[] \setupcite[] \starttext Bonjour de luatex! \blank LUA \cite[year][destv] \startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua \completepublications[criterium=all] \stoptext .. I see this in the messages: publications : warning: cite argument destv is unknown

Re: [NTG-context] Bibliography and luatex

2008-01-16 Thread Jean Magnan de Bornier
[] | \starttext | Bonjour de luatex! | \blank | LUA \cite[year][destv] | \startlua | a = 1.5 | b = 1.8 | c = a*b | tex.print(c) | \stoplua | \completepublications[criterium=all] | \stoptext | .. | | I see this in the messages: | | publications : warning: cite

[NTG-context] 'TeX capacity exceeded' problem

2007-10-11 Thread Jeong Dalyoung
\starttext some texts \startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua \stoptext and it was working nicely. But when I tested a sample file in the wiki, \usetypescript[palatino] \setupbodyfont[palatino,12pt] \starttext effe fietsen 2: \input tufte $\sqrt{2}$ \eogonek \sc effe fietsen 2

Re: [NTG-context] 'TeX capacity exceeded' problem

2007-10-11 Thread Hans Hagen
/... I test it using a simple file like \starttext some texts \startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua \stoptext and it was working nicely. problems like this will go away with the next release, since mkiv will load patterns at runtime (smaller format, faster loading

[NTG-context] Installing MKiv

2007-08-12 Thread Jean Magnan de Bornier
\startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua \stoptext But no pdf file appears, and here are some (hopefully) relevant parts of the compilation message: TeXExec | unable to fix backend map path TeXExec | running: luatools --fmt=cont-en test.tex LuaTools | using format name /cont-en.fmt

Re: [NTG-context] Installing MKiv

2007-08-12 Thread luigi scarso
Hi all, Following nice reports I read on the list as well as the mag-12 instructions I installed a context minimal linux distribution and lua-5.1.2. hmm, try http://www.lua.org/ftp/lua-5.1.tar.gz % engine=luatex \starttext Hello from luatex \blank LUA \startlua a = 1.5 b = 1.8 c = a*b

Re: [NTG-context] Installing MKiv

2007-08-12 Thread Hans Hagen
\starttext Hello from luatex \blank LUA \startlua a = 1.5 b = 1.8 c = a*b tex.print(c) \stoplua \stoptext But no pdf file appears, and here are some (hopefully) relevant parts of the compilation message: TeXExec | unable to fix backend map path TeXExec | running: luatools --fmt=cont-en

Re: [NTG-context] Installing MKiv

2007-08-12 Thread Jean Magnan de Bornier
| \startlua | a = 1.5 | b = 1.8 | c = a*b | tex.print(c) | \stoplua | \stoptext | on a linux box | $texmfstart texexec --pdf test.tex | compile well. | Are you under linux ? Yes, I ought to have said that first!! Now here is what I tried just now: 1/ reinstall lua by hand 2/ remove everything

Re: [NTG-context] Installing MKiv

2007-08-12 Thread luigi scarso
| % engine=luatex | \starttext | Hello from luatex | \blank | LUA | \startlua | a = 1.5 | b = 1.8 | c = a*b | tex.print(c) | \stoplua | \stoptext | on a linux box | $texmfstart texexec --pdf test.tex | compile well. | Are you under linux ? Yes, I ought to have said that first

Re: [NTG-context] luac-texluac-luatex-texlua-...

2007-08-08 Thread WN
and named it texlua and put it in the texmf-linux/bin directory. Then after reading the MyWay on MKIV I did a texexec --make --all --luatex to generate the formats and ran succesfully the following tex script and produced a pdf file. % engine=luatex \starttext Hello from luatex \blank LUA \startlua